package com.hgy.carsb.controller;

import com.hgy.carsb.entity.EveryMonthData;
import com.hgy.carsb.entity.Total;
import com.hgy.carsb.service.MonthInfoService;
import com.hgy.carsb.service.OverlayInfoService;
import com.hgy.carsb.service.SignalInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/ii")
public class IiController {
    @Autowired
    private MonthInfoService monthInfoService;

    @Autowired
    private SignalInfoService signalInfoService;

    private int year = 2020;
    private int month = 4;
    @GetMapping("/total")
    public List<Total> getYearPssTotal(){
        List<Total> list = new ArrayList<>();
        list.add(signalInfoService.getTotal(year, month, "interest", "FAW"));
        list.add(signalInfoService.getTotal(year, month, "income", "FAW"));
        return list;
    }

    @GetMapping("/month")
    public List<EveryMonthData> getMonthPssTotal(){
        List<EveryMonthData> list = new ArrayList<>();
        list.add(monthInfoService.getDetail(year-1, "interest", "FAW"));
        list.add(monthInfoService.getDetail(year-1, "income", "FAW"));
        return list;
    }
}
